﻿using Corina.Datamodel.Base;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace Corina.DataContext.DatabaseOperator
{
    public class DatabaseCommon
    {
        public static List<SqlParameter> GetParameterFromEntity(DatamodelEntityBase entity)
        {
            List<SqlParameter> paras = new List<SqlParameter>();
            foreach (DatabaseColumn column in entity.Columns())
            {
                paras.Add(new SqlParameter("@" + column.ColumnName, entity.GetPropertyValue(column.ColumnName)));
            }

            return paras;
        }

    }


}
